package org.frankkie.parcdroid;

import android.graphics.Canvas;
import android.graphics.Paint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import java.util.ArrayList;

/**
 *
 * @author frankkie
 */
public class OverlayDebugInfo extends Overlay {

  public static boolean drawDebugLayer = true;
  ArrayList<String> deStrs = new ArrayList<String>();

  @Override
  public void draw(Canvas canvas, MapView mv, boolean bool) {
    if (drawDebugLayer) {
      super.draw(canvas, mv, bool);
      deStrs.clear();
      deStrs.add("Positie:");
      deStrs.add("" + MainActivity.location.getLatitude());
      deStrs.add("" + MainActivity.location.getLongitude());
      deStrs.add("MapCenter:");
      deStrs.add("" + mv.getMapCenter().getLatitudeE6());
      deStrs.add("" + mv.getMapCenter().getLongitudeE6());
      deStrs.add("Zoom: " + mv.getZoomLevel());
      String watte = "";
      if (MainActivity.fakeLokatieGebruiken){watte="Fake Lokatie";}else{watte="GPS Positie";}
      deStrs.add("Lokatie: " + watte);
      Paint paint = new Paint();
      paint.setTextAlign(Paint.Align.LEFT);
      paint.setARGB(100, 0, 0, 0);
      canvas.drawRect(0, 5, 100, 5+(20*(deStrs.size()+1)), paint);
      paint.setTextSize(16);
      paint.setFakeBoldText(true);
      paint.setARGB(255, 255, 0, 0);
      int yy = 25;
      for (int a = 0; a < deStrs.size(); a++) {
        canvas.drawText(deStrs.get(a), 0, deStrs.get(a).length(), 5, yy, paint);
        yy += 20;
      }
      //canvas.drawCircle(50, 50, 500, paint);
    }
  }
}
